// TOWN SCRIPT
//    Town 0: Cresent Tail

// This is the special encounter script for this town.
// The states INIT_STATE, EXIT_STATE, and START_STATE have
// meanings that are described in the documenation. States you write
// yourself should be numbered from 10-100.

begintownscript;

variables;

short choice;

body;

beginstate INIT_STATE;
	set_crime_tolerance(6);

	set_name(10, "Fido");
	set_name(11, "Stinky Pete");
	set_char_dialogue_pic(11, 531, 0);
	set_name(12, "Frisky");
	set_name(13, "Jane");
	set_char_dialogue_pic(13, 525, 0);
break;

beginstate EXIT_STATE;
// Always called when the town is left.
break;

beginstate START_STATE;
	if (get_ran(1, 0, 100) < 5)
		text_bubble_on_char(10, "Woof Woof");
	if (get_ran(1, 0, 100) < 5) {
		if (get_ran(1, 0, 100) < 50)
			text_bubble_on_char(12, "Purrrrrr");
		else
			text_bubble_on_char(12, "Meow");
	}
break;

beginstate 10;
	if (get_flag(0, 0) == 0) {
		set_flag(0, 0, 1);
		message_dialog("You reach the end of the dock.  Waves lap gently against the empty dock.", "No boats are here because of the empire quarantine.");
	}
break;

beginstate 11;
	if (get_flag(0, 1) == 0) {
		set_flag(0, 1, 1);
		message_dialog("The warehouse is empty.", "With no boats docking, there is no trade.");
	}
break;

beginstate 12;
	if (get_flag(0, 2) == 0) {
		set_flag(0, 2, 1);
		message_dialog("The warehouse is empty.", "With no boats docking, there is no trade.");
	}
break;

beginstate 13;
	if (get_flag(0, 3) == 0) {
		set_flag(0, 3, 1);
		message_dialog("The house is dusty and empty.", "With the trade dried up, the people who lived here left.");
	}
break;

beginstate 14;
	if (get_flag(0, 5) == 0) {
		set_flag(0, 5, 1);
		message_dialog("Ah ha, whomever lived here seemed to have forgot a chest.", "");
	}
break;

beginstate 15;
	reset_dialog();
	add_dialog_str(0, "The beds here seem comfortable and remarkably still seem fairly clean.", 0);
	add_dialog_str(1, "Since the place seems peaceful and out of the way, do you rest?", 0);
	add_dialog_choice(0, "Leave");
	add_dialog_choice(1, "Lay down and rest");
	choice = run_dialog(1);
	if (choice == 2) {
		set_ticks_forward(500);
		revive_party();
		message_dialog("The rest was peaceful and relaxing.", "You arise completely refreshed.");
	}
break;

beginstate 16;
	if (get_flag(0, 7) == 0) {
		set_flag(0, 7, 1);
		message_dialog("You enter the shop and immediately wrinkle your nose from the smell of fish.", "Racks of fishing gear line the walls and the man gutting fish behind the counter stinks of the fish stench also.");
	}
break;

beginstate 17;
	if (get_flag(0, 8) == 0) {
		set_flag(0, 8, 1);
		message_dialog("Judging from the used hooks, line and thown away bait, this appears to be where Pete gets the fresh catch.", "You carefully avoid the fish guts spilled out on the ground here.");
	}
break;

beginstate 18;
	message_dialog("Inside the chest seems to be Pete's fishing gear.", "The smell from the gear makes you gag and feel weak.");
	play_sound(-66);
	set_char_status(1000, 21, 25, 1, 0);
break;

